<template>
	<div>
		<div class="div1_pic">
			<aside><i class="el-icon-message"></i></aside>
			<aside><i class="el-icon-lock"></i></aside>
		</div>
		<i class="el-icon-reading"></i>
		<div class="div1">
			<input type="text" placeholder="邮箱" name="email" required />
			<input type="password" placeholder="密码" name="pwd" id="pwd2" required>
		</div>
		<input class="btn" type="submit" @click="login()" value="登录" />
	</div>
</template>

<script>
	export default {
		name: 'Login2',
		props: ['proplist'],
		computed: {},
		methods: {
			login() {
				let kv = this.user;
				this.$postkv("/api/login", kv).then((resp) => {
					let token = resp.data.data.token;
					console.log(resp.data.data.token);
					window.localStorage.setItem('token', token)
					this.$get("/api/user/info", this.user).then((resp) => {
						console.log(resp.data)
						window.localStorage.setItem("name", resp.data.data.name)
						window.localStorage.setItem("img", resp.data.data.img)
						window.localStorage.setItem("role", resp.data.data.role)
						window.localStorage.setItem("account", resp.data.data.account)
						window.localStorage.setItem("time", new Date().getTime())
						this.$store.state.name = resp.data.data.name;
						this.$store.state.role = resp.data.data.role;
						this.$store.state.img = resp.data.data.img;
						this.$store.state.account = resp.data.data.account;
						this.$store.state.time = resp.data.data.time;
						this.$router.push("/mobile/home")
					})
				})
			}
	}
	}
</script>

<style scoped>
	i {
		font-size: 8rem;

	}

	.div1_pic {
		margin-top: -1.2rem;
	}

	.div1_pic aside {
		height: 2rem;
		text-align: left;
		line-height: 31rem;
		margin-left: 3.2rem;
		margin-top: 1.2rem;
	}

	.div1_pic i {
		font-size: 1.3rem;
		margin-left: 0.5rem;
	}

	.div1 input {
		width: 75%;
		border-radius: 0.3rem;
		border: white 1px solid;
		background-color: transparent;
		color: white;
		height: 2rem;
		text-indent: 2rem;
		margin-top: 1rem;
	}

	::placeholder {
		color: white;
	}

	.btn {
		margin-top: 2rem;
		width: 75%;
		height: 2.5rem;
		border-radius: 0.3rem;
		border: #f26c6b 1px solid;
		background-color: #f26c6b;
		color: white;
		font-size: 1.3rem;
	}
</style>